<%-- 
    Document   : viewpartlist
    Created on : Aug 18, 2011, 9:37:52 PM
    Author     : s4201567 Tony Yu
--%>

<style>
    #poll-id {
        padding-left: 350px;
        padding-bottom:20px;
        
    }
    #demo {
        padding-left: 80px;
    }
    
    #users {
        padding-left: 80px;
    }
    
    #master-title {
        text-align:center;
        padding-bottom:20px;
    }
    
   .mastertable {
    font-family:"Trebuchet MS", Arial, Helvetica, sans-serif;
    width:80%;
    border:1px solid #009933;
    text-align:center;
    }
    .mastertable td, .mastertable th .mastertable tr {
    font-size:1em;    
    border:1px solid #009933;
    padding:3px 7px 2px 17px;
    }
    .mastertable th {
    font-size:1.1em;
    text-align:center;
    padding-top:5px;
    padding-bottom:4px;
    background-color:#008833;
    color:#ffffff;
    }
    
    .button{
       padding-top:20px;
       padding-bottom: 40px;
    }
</style>

<script type="text/javascript">
    function addPoll(tempID, temp) {
        var pid = document.getElementById('add').value;
        window.location="viewList.html?&tempID="+tempID+"&temp="+temp+"&pid="+pid;
    }
    
    function createTemp(tempID, temp) {
        var pid = document.getElementById('add').value;
        window.location="viewList.html?&tempID="+tempID+"&temp="+temp+"&pid="+pid+"&done=1";
    }
</script>

<%@ include file="../header.jsp" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<div id="content-container1">
        <div id="content">  
            <%if (request.getParameter("tempID") != null) {%>  
            <div id="master-title">
                <h3>Details for a Participant List</h3>
            </div>
              
            
            <%
                String id = request.getParameter("pid");
                if (id == null) {
                    id = "0";
                }
                
                String tempID = request.getParameter("tempID");
                String temp = request.getParameter("temp");
                String uid = request.getParameter("uid");
                
                //REMOVE
                uid = "1";
            %>
            <div id="poll-id">
                Add poll (optional): <input type="text" id="add" value="<%=id%>"/>
            <input type="button" value="Add" onclick="addPoll('<%=tempID%>','<%=temp%>')" />
            </div>

            <div  id="users">
                <table class="mastertable">
                    <tr>
                        <th>Participant ID's</th>
                        <th>Edit Participant's Details</th>
                    </tr>
                    <tr>
                    <c:forEach items="${parts}" var="part">
                        <tr>          
                            <td>${part.getParticipantID()}</td>
                            <td><a href="partListDetails.html?uid=${part.getParticipantID()}&tempID=<%=tempID%>">Edit</a></td>
                        </tr>  
                    </c:forEach>

                </table>
                <div class="button">
                    <input type="button" onClick="window.location.href='editPartList.html?tempID=<%=tempID%>'" value="Add New Participant"/>
                </div>
            </div>
            <% String tempName = request.getParameter("temp"); %>
            <div id="master-title">
                <h3>Details of Template</h3>
            </div>
            <div id="demo">
                <table class="mastertable">
                    <tr>
                        <th>Template</th>
                        <th>Demographics</th>
                    </tr>
                    <% 
                        int count = 0; 
                        if (count == 0) {
                    %>
                    <tr><td><%=tempName%></td></tr>
                    <% } %>
                    <c:forEach items="${demos}" var="demo">
                        <tr>          
                        
                        </tr>
                    </c:forEach>
                </table>
                <div class="button">
                    <input type="button" onClick="window.location.href='customDemo.html?tempID=<%=tempID%>'" value="Create New Demographic"/><br/><br/><br/><br/>
                    <input type="button" value="Create Participant List" onclick="createTemp('<%=tempID%>', '<%=temp%>')"/>
                    <input type="button" onClick="window.location.href='partList.html'" value="Back"/>
                </div>    
            </div>
         
        </div>
        <% } else
            out.println("<p>The page was improperally formed, try going back and trying again.</p>");
         %>
	
    </div>		
	
<%@ include file="../footer.jsp" %>

